home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / GUICtrlRead.au3 < prev    next >
Text File  |  2007-09-08  |  888b  |  24 lines

  1. #include <GUIConstants.au3>
  2.  
  3. GUICreate("My GUICtrlRead") ; will create a dialog box that when displayed is centered
  4.  
  5. $menu1    = GUICtrlCreateMenu("File")
  6.  
  7. $n1        = GUICtrlCreateList("", 10, 10, -1, 100)
  8. GUICtrlSetData(-1, "item1|item2|item3", "item2")
  9.  
  10. $n2        = GUICtrlCreateButton("Read", 10, 100, 50)
  11. GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button
  12.  
  13. GUISetState () ; will display an empty dialog box
  14. ; Run the GUI until the dialog is closed
  15. Do
  16.     $msg = GUIGetMsg()
  17.     if $msg = $n2 Then
  18.         Msgbox(0, "Selected listbox entry", GUICtrlRead($n1)) ; display the selected listbox entry
  19.         $menustate    = GUICtrlRead($menu1) ; return the state of the menu item
  20.         $menutext    = GUICtrlRead($menu1, 1) ; return the text of the menu item
  21.         Msgbox(0, "State and text of the menuitem", "state:" & $menustate & @LF & "text:" & $menutext)
  22.     EndIf
  23. Until $msg = $GUI_EVENT_CLOSE 
  24.